import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { RootState } from '../../store'
import { clearSearchListActionCreate } from '../../store/search/searchReducer'
const Index: React.FC = () => {
	const dispatch = useDispatch()
	const searchList = useSelector((state: RootState) => state.searchReducer.searchList)
	return (
		<div>
			<button onClick={() => dispatch(clearSearchListActionCreate())}>删除</button>
			<div>
				<ul>
					{
						searchList.length > 0 ? searchList.map((v, i) => {
							return <li key={i}>{v}</li>
						}) : <h1>没有搜索的记录</h1>
					}
				</ul>
			</div>
		</div>
	)
}


export default Index